/**
 * Created by zhang_000 on 2015/9/11.
 */

mainApp.controller("userlistCtrl", function ($scope,$timeout) {



    $scope.userListColu = [
        { field: "username"},
        { field: "name"},
        { field: "sex"},
        { field: "gcode"},
        { field: "department"},
        { field: "phone"},
        { field: "tel"},
        { command: ["edit", "destroy"] }
    ];
    $scope.toolbar=['create', "save", "cancel"];

    $scope.userListData = new kendo.data.DataSource({
        transport:{
            read:{
                url:'/manager/userlist',
                dataType:'json'
            },
            create:{
                url:'/manager/useradd',
                type:'post',
                dataType:'json'
            },
            destroy:{
                url:'/manager/userdel',
                type:'post',
                dataType:'json'
            },
            update:{
                url:'/manager/useredit',
                type:'post',
                dataType:'json'
            }
        },
        schema: {
            model: {
                id: "id",
                fields:{
                    username:{
                        type: "string",
                        validation: {
                            //required: true,
                            customRule1: function(input){
                                input.validationMessage='111';
                                return $.trim(input.val()) !== "";
                            }
                        },
                        messages:{
                            customRule1:'1111'
                        },
                        validationMessage:{
                            customRule1:'1111'
                        }
                    },
                    name:{
                        validation: { // validation rules
                            required: true // the field is required,
                        }
                    }
                }
            }
        }
    });


});

mainApp.controller("spiderCtrl",function($scope){

});